]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Close conflicting session dialog after 60 secs
authorJoan Torres <joan.torres@suse.com>
Mon, 12 Feb 2024 17:10:25 +0000 (18:10 +0100)
committerRay Strode <halfline@gmail.com>
Thu, 29 Feb 2024 20:42:52 +0000 (20:42 +0000)
When the stop conflicting session dialog is opened, use a timeout of 60
seconds to close it.
This is an attempt to keep security in the situation where the user leaves,
the system is left unsupervised and the dialog is opened; allowing anyone
to stop the old session and start a new session.

When the dialog is closed by the timeout, a notification apperars informing
about that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3134>

js/gdm/loginDialog.js

index c0ded7506100c1e0b8790ae8414adebe84919c5f..28db1a9deff8134266e8e711023819abb1ca49b5 100644 (file)
@@ -36,6 +36,7 @@ import * as GdmUtil from './util.js';
 import * as Layout from '../ui/layout.js';
 import * as LoginManager from '../misc/loginManager.js';
 import * as Main from '../ui/main.js';
+import * as MessageTray from '../ui/messageTray.js';
 import * as ModalDialog from '../ui/modalDialog.js';
 import * as PopupMenu from '../ui/popupMenu.js';
 import * as Realmd from './realmd.js';
@@ -44,6 +45,7 @@ import * as UserWidget from '../ui/userWidget.js';
 const _FADE_ANIMATION_TIME = 250;
 const _SCROLL_ANIMATION_TIME = 500;
 const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0;
+const _CONFLICTING_SESSION_DIALOG_TIMEOUT = 60;
 
 export const UserListItem = GObject.registerClass({
     Signals: {'activate': {}},
@@ -1071,6 +1073,22 @@ export const LoginDialog = GObject.registerClass({
         }, this);
     }
 
+    _notifyConflictingSessionDialogClosed(userName) {
+        const source = new MessageTray.SystemNotificationSource();
+        Main.messageTray.add(source);
+
+        this._conflictingSessionNotification = new MessageTray.Notification(source,
+            _('Stop conflicting session dialog closed'),
+            _('Try to login again to start a session for user %s.').format(userName));
+        this._conflictingSessionNotification.setUrgency(MessageTray.Urgency.CRITICAL);
+        this._conflictingSessionNotification.setTransient(true);
+        this._conflictingSessionNotification.connect('destroy', () => {
+            this._conflictingSessionNotification = null;
+        });
+
+        source.showNotification(this._conflictingSessionNotification);
+    }
+
     _showConflictingSessionDialog(serviceName, conflictingSession) {
         let conflictingSessionDialog = new ConflictingSessionDialog(conflictingSession,
             this._greeterSessionProxy,
@@ -1092,6 +1110,17 @@ export const LoginDialog = GObject.registerClass({
             }
         }, conflictingSessionDialog);
 
+        const closeDialogTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, _CONFLICTING_SESSION_DIALOG_TIMEOUT, () => {
+            this._notifyConflictingSessionDialogClosed(this._user.get_user_name());
+            conflictingSessionDialog.close();
+            this._authPrompt.reset();
+            return GLib.SOURCE_REMOVE;
+        });
+
+        conflictingSessionDialog.connect('closed', () => {
+            GLib.source_remove(closeDialogTimeoutId);
+        });
+
         conflictingSessionDialog.open();
     }
 
@@ -1333,6 +1362,9 @@ export const LoginDialog = GObject.registerClass({
 
         this._updateCancelButton();
 
+        if (this._conflictingSessionNotification)
+            this._conflictingSessionNotification.destroy();
+
         const batch = new Batch.ConcurrentBatch(this, [
             GdmUtil.cloneAndFadeOutActor(this._userSelectionBox),
             this._beginVerificationForItem(activatedItem),